package com.yanqu.road.server.gameplayer.module.activity.cat.action;

import com.yanqu.road.entity.activity.cat.Element;
import com.yanqu.road.entity.activity.cat.eElementTypes;
import com.yanqu.road.server.gameplayer.module.activity.cat.ConnectResult;
import com.yanqu.road.server.manger.activity.cat.CatMgr;

public class RoleElementAction extends BaseElementAction {

    public RoleElementAction(int type) {
        super(type);
    }

    @Override
    public boolean accept(Element element, Element next, ConnectResult context) {
        //第一个不能是小怪
        if(next.getType() == eElementTypes.Monster.getType()){
            context.setRet(-1);
            return false;
        }
        if(CatMgr.isBlock(next)){
            context.setRet(-1);
            return false;
        }
        return super.acceptNext(context);
    }

    @Override
    public void connect(Element element, ConnectResult context) {
        super.connectNext(context);
    }

    @Override
    public void change(Element element, ConnectResult context) {
        DharmaElementAction.onChange(element, context);
        super.changeNext(context);
    }

    @Override
    void attack(Element element, ConnectResult context) {
        super.attackNext(context);
    }

    @Override
    void generate(Element element, ConnectResult context) {
        super.generateNext(context);
    }
}
